package service;

import bean.User;
import dao.IBaseDAO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class SystemService {

    @Resource
    private IBaseDAO userDAO;

    public User authenticate(String username) {
        List<User> userList = userDAO.getByField("username", username);
        if (userList.isEmpty()) {
            return null;
        } else {
            return userList.get(0);
        }
    }
}
